package com.game.primitive;

import com.game.net.server.jpbsocket.JPbSocketNettyServer;
import com.game.common.QueueEventThread;
import com.game.primitive.common.PrimitiveMongoUtil;
import com.game.primitive.context.PrimitiveLoop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by legend9999 on 2016/6/5.
 */
public class PrimitiveMain {
	private static Logger logger = LoggerFactory.getLogger(PrimitiveMain.class);

	public static void main(String[] args) throws InterruptedException {
		ApplicationContext ac = new ClassPathXmlApplicationContext("spring.xml");
		new PrimitiveMongoUtil().start();
		new Thread(ac.getBean(QueueEventThread.class)).start();
		new Thread(ac.getBean(PrimitiveLoop.class)).start();
		PrimitiveJPbServerHandler primitiveJPbServerHandler = ac.getBean(PrimitiveJPbServerHandler.class);
		JPbSocketNettyServer jPbSocketNettyServer = ac.getBean(JPbSocketNettyServer.class);
		jPbSocketNettyServer.init(50000,primitiveJPbServerHandler);
	}
}
